use std::fs::File;
use std::io::prelude::*;

fn main() {
    let file = File::open("input.txt");
    match file {
        Ok(file) => {
            let mut reader = std::io::BufReader::new(file);
            let mut contents = String::new();
            reader.read_to_string(&mut contents).unwrap();
            println!("File contents: {}", contents);

            // 对文件内容进行处理
            let processed_contents = process_file_contents(&contents);

            let file = File::create("output.txt").unwrap();
            let mut writer = std::io::BufWriter::new(file);
            writer.write_all(processed_contents.as_bytes()).unwrap();
        },
        Err(error) => println!("Error opening file: {}", error),
    }
}

fn process_file_contents(contents: &str) -> String {
    // 在这里对文件内容进行处理，这里只是简单地返回原始内容
    contents.to_string()
}